﻿Public Module ModuleArtist
	Sub AddToListView(ByRef artists() As Artist, ByRef listview As ListView)
		If IsNothing(artists) Then
			Return
		End If

		Dim art As New PictureBox

		For Each artist As Artist In artists
			Dim item As ListViewItem = GenerateListViewItemSearch(artist.name, artist.name, "", artist.mbid, 0, listview.Groups("Artists"))
			If Not (IsNothing(artist.image)) Then
				If artist.image(2) <> Nothing Then
					art.Load(artist.image(2))
					listview.SmallImageList.Images.Add(art.Image)
					item.ImageIndex = listview.SmallImageList.Images.Count - 1
				End If
			End If

			listview.Items.Add(item)
		Next

		listview.LargeImageList = listview.SmallImageList
		art.Dispose()
	End Sub
End Module
